// alert(window.localStorage.getItem('code'));
// alert(window.localStorage.getItem('cphone'));
 //手机绑定
  $('#submit-btn').click(function(){
        	myForm = collectForm();
        	if(checkForm(myForm)){
        		return false;
        	}
        	
        	jQuery.support.cors = true;
        	
    		var httpHost = getHttpHost();	    			
    		$.post(httpHost+'/index/Base/bilndphone.html',myForm,function(d){
    			console.log(d);
    			
			  da=JSON.parse(d);		
		      if(da.code==400){
//		      	alert(da.msg);
				window.location.href='blindpwd.html';
		      }else{
		      	alert(da.msg);
		      }
		      
		      
		    })
        })
  
//得到表单数据
		function  collectForm(){
		    var myForm = {};
		    myForm.user_name = $('#phone').val();
			myForm.code = $('#messageCode').val();
			myForm.token = getToken();
			myForm.vcode=window.localStorage.getItem('code');
			myForm.phone=window.localStorage.getItem('cphone');
		    return myForm;
		}
		//表单验证
		function checkForm(data){
			
			var phone = data.user_name;
			var mobile_phone2 = /^1[3|4|5|7|8]\d{9}$/;
			if (phone=='' || !mobile_phone2.test(phone) ) {
        		alert('手机号不正确');
        		return true;
			}
			if(data.code==''){
				alert('验证码不能为空');
				return true;
			}
		}